/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fmslauncher;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author rbs
 */
public class Client{

    private Socket server;
    private BufferedReader input;
    private PrintWriter output;

    public Client() throws InterruptedException, UnknownHostException, IOException {

            //args: RIC - FUNC - TXT
            server = new Socket("localhost", 10114);
            System.out.println("Connected");
            input = new BufferedReader(new InputStreamReader(server.getInputStream()));
            output = new PrintWriter(server.getOutputStream(), true);

    }

    public void SendLine(String str)
    {
        output.println(str);
        output.flush();
    }


    public String RecLine() throws IOException
    {
        return input.readLine();
    }

    public boolean isConnected()
    {
        return server.isConnected();
    }

    public boolean ready() throws IOException {
        return input.ready();
    }

    public void Close() throws IOException
    {
        server.close();
    }





}
